<?php
require 'db.php';
require 'function.php';
$shop = new Manager($link);
$id = $_GET['id'];

    if (isset($_POST['submit'])){
        
        $name = $_POST['name'];
        $price = $_POST['price'];
        $o_price = $_POST['o_price'];
        $img = $_POST['img'];
        $descript = $_POST['descript'];
        $category = $_POST['category'];
        
        $query = $shop->editShop($name, $price,$o_price,$img,$descript,$category,$id);
        if ($query){
            header("Location:m_shop.php");
        }
        else{
            echo "<script>alert('修改失败！');</script>";
            echo "<script>history.go(-1);</script>";
            exit();
        }
    }





$data = $shop->getShopById($id);
require 'sedit.html';
?>